﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Firefly.Libs;
using Microsoft.Xna.Framework.Input;

namespace Ether
{
    public sealed class DebugCamera : Camera
    {
        //Fields
        private const float camRotateSpeed = 3f;

        //Construct
        public DebugCamera(Game game, Vector3 Start)
            : base(game, Start, Vector3.Zero)
        {

        }

        //Methods
        public override void UpdateCamera(Input input)
        {
            float rotateY = 0f;
            float rotateX = 0f;

            if (input.IsKeyDown(Keys.Q))
                rotateY -= (0.01f * camRotateSpeed);
            else if (input.IsKeyDown(Keys.E))
                rotateY += (0.01f * camRotateSpeed);

            if (input.IsKeyDown(Keys.W))
                rotateX -= (0.01f * camRotateSpeed);
            else if (input.IsKeyDown(Keys.S))
                rotateX += (0.01f * camRotateSpeed);   

            CameraPosition = Vector3.Transform(CameraPosition - CameraTarget, Matrix.CreateRotationY(rotateY)) + CameraTarget;
            CameraPosition = Vector3.Transform(CameraPosition - CameraTarget, Matrix.CreateRotationX(rotateX)) + CameraTarget;
        }
    }
}
